import string def process_line(line, word_count_dict): '''Process the line to get lowercase words to add to the dictionary.''' line = line.strip() word_list = line.split() for word in word_list: # ignore the '--' that is in the file if word != '--': word = word.lower() word = word.strip() # get commas, periods and other punctuation out as well word = word.strip(string.punctuation) add_word(word, word_count_dict)